package www.dianbaozu.com.ui.server.channelDetail.adapter

import androidx.recyclerview.widget.RecyclerView
import com.netease.nim.uikit.R
import com.netease.nim.uikit.api.NIMHelper
import www.dianbaozu.com.ui.chat.friend.holder.FriendTopViewHolder
import com.netease.nim.uikit.common.ui.recyclerview.adapter.BaseMultiItemQuickAdapter
import com.netease.nim.uikit.common.ui.recyclerview.holder.BaseViewHolder
import www.dianbaozu.com.ui.chat.findFriend.holder.HeaderViewHolder
import www.dianbaozu.com.ui.chat.friend.holder.FriendUserViewHolder
import www.dianbaozu.com.ui.server.channelDetail.holder.ChannelDetailUserViewHolder
import www.wen.com.common.lib.data.entities.FriendEntity
import www.wen.com.common.lib.data.entities.ServiceMemberEntity

class ChannelDetailAdapter(recyclerView: RecyclerView, data: List<Any>) :
    BaseMultiItemQuickAdapter<Any, BaseViewHolder>(recyclerView, data) {

    companion object {
        const val VIEW_TYPE_TOP = 1
        const val VIEW_TYPE_USER = 2
    }

    init {
        addItemType(VIEW_TYPE_TOP, R.layout.item_header, HeaderViewHolder::class.java)
        addItemType(VIEW_TYPE_USER, R.layout.item_friends, ChannelDetailUserViewHolder::class.java)
    }

    override fun getViewType(item: Any): Int =
        if (item is ServiceMemberEntity) {
            VIEW_TYPE_USER
        } else {
            VIEW_TYPE_TOP
        }

    override fun getItemKey(item: Any?): String =
        item.toString()
}